package com.example.coursehub.repository;

import com.example.coursehub.entity.Exercise;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

public interface ExerciseRepository extends JpaRepository<Exercise, String>, JpaSpecificationExecutor<Exercise> {
    @Query("SELECT e FROM Exercise e " +
           "JOIN e.classes c " +
           "WHERE c.classesId IN :classIds")
    List<Exercise> findByClassesIdIn(List<String> classIds);

    List<Exercise> findByClasses_ClassesId(String classesId);

//    List<Exercise> findByClasses_ClassId(String classId);
}